/*     */ package com.umeng.fb.model;
/*     */ 
/*     */ import android.content.Context;
/*     */ import android.content.SharedPreferences;
/*     */ import android.content.SharedPreferences.Editor;
/*     */ import java.util.ArrayList;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import org.json.JSONArray;
/*     */ import org.json.JSONException;
/*     */ import org.json.JSONObject;
/*     */ 
/*     */ public class Store
/*     */ {
/*  24 */   private static final String a = Store.class.getName();
/*     */   private static Store b;
/*     */   private Context c;
/*     */   private static final String d = "umeng_feedback_conversations";
/*     */   private static final String e = "umeng_feedback_user_info";
/*     */   private static final String f = "user";
/*     */   private static final String g = "last_update_at";
/*     */   private static final String h = "last_sync_at";
/*     */ 
/*     */   private Store(Context paramContext)
/*     */   {
/*  47 */     this.c = paramContext.getApplicationContext();
/*     */   }
/*     */ 
/*     */   public static Store getInstance(Context paramContext)
/*     */   {
/*  54 */     if (b == null)
/*  55 */       b = new Store(paramContext);
/*  56 */     return b;
/*     */   }
/*     */ 
/*     */   public void saveCoversation(Conversation paramConversation)
/*     */   {
/*  61 */     this.c.getSharedPreferences("umeng_feedback_conversations", 0)
/*  62 */       .edit().putString(paramConversation.getId(), paramConversation.a().toString())
/*  63 */       .commit();
/*     */   }
/*     */ 
/*     */   public void saveUserInfo(UserInfo paramUserInfo)
/*     */   {
/*  68 */     this.c.getSharedPreferences("umeng_feedback_user_info", 0)
/*  69 */       .edit()
/*  70 */       .putString("user", paramUserInfo.toJson().toString())
/*  71 */       .putLong("last_update_at", 
/*  72 */       System.currentTimeMillis()).commit();
/*     */   }
/*     */ 
/*     */   public UserInfo getUserInfo()
/*     */   {
/*  85 */     String str = this.c.getSharedPreferences("umeng_feedback_user_info", 
/*  86 */       0).getString("user", "");
/*     */ 
/*  89 */     if ("".equals(str))
/*  90 */       return null;
/*     */     try {
/*  92 */       return new UserInfo(new JSONObject(str));
/*     */     } catch (JSONException localJSONException) {
/*  94 */       localJSONException.printStackTrace();
/*     */     }
/*  96 */     return null;
/*     */   }
/*     */ 
/*     */   public long getUserInfoLastUpdateAt()
/*     */   {
/* 107 */     long l = this.c.getSharedPreferences("umeng_feedback_user_info", 
/* 108 */       0).getLong("last_update_at", 
/* 109 */       0L);
/*     */ 
/* 111 */     return l;
/*     */   }
/*     */ 
/*     */   public long getUserInfoLastSyncAt()
/*     */   {
/* 121 */     long l = this.c.getSharedPreferences("umeng_feedback_user_info", 
/* 122 */       0).getLong("last_sync_at", 0L);
/*     */ 
/* 124 */     return l;
/*     */   }
/*     */ 
/*     */   public void setUserInfoLastSyncAt(long paramLong)
/*     */   {
/* 135 */     this.c.getSharedPreferences("umeng_feedback_user_info", 0)
/* 136 */       .edit().putLong("last_sync_at", paramLong).commit();
/*     */   }
/*     */ 
/*     */   public Conversation getConversationById(String paramString) {
/*     */     try {
/* 141 */       SharedPreferences localSharedPreferences = this.c.getSharedPreferences(
/* 142 */         "umeng_feedback_conversations", 0);
/* 143 */       String str = localSharedPreferences.getString(paramString, "");
/*     */ 
/* 145 */       return new Conversation(paramString, new JSONArray(str), 
/* 146 */         this.c);
/*     */     }
/*     */     catch (JSONException localJSONException) {
/* 149 */       localJSONException.printStackTrace();
/*     */     }
/* 151 */     return null;
/*     */   }
/*     */ 
/*     */   public List<String> getAllConversationIds()
/*     */   {
/* 160 */     SharedPreferences localSharedPreferences = this.c.getSharedPreferences(
/* 161 */       "umeng_feedback_conversations", 0);
/* 162 */     Map localMap = localSharedPreferences.getAll();
/* 163 */     ArrayList localArrayList = new ArrayList();
/* 164 */     for (String str : localMap.keySet()) {
/* 165 */       localArrayList.add(str);
/*     */     }
/*     */ 
/* 169 */     return localArrayList;
/*     */   }
/*     */ 
/*     */   void a()
/*     */   {
/* 176 */     this.c.getSharedPreferences("umeng_feedback_conversations", 0)
/* 177 */       .edit().clear().commit();
/* 178 */     this.c.getSharedPreferences("umeng_feedback_user_info", 0)
/* 179 */       .edit().clear().commit();
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.fb.model.Store
 * JD-Core Version:    0.6.2
 */